package com.ldu.exam.model;

import java.sql.Timestamp;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Builder
@Table(name="t_paper")
public class TestPaperModel 
{
	@Id
	@Column(length=32)
	@GeneratedValue(strategy = GenerationType.IDENTITY,generator = "jpa-uuid")
	@GenericGenerator(name = "jpa-uuid",strategy = "uuid.hex")
	private String id;
	
	/**
	 * 试卷名称
	 */
	private String name;
	
	/**
	 * 试卷编号(自动增长)
	 */
	private int number;
	
	/**
	 * 试卷内容
	 */
	private String content;
	
	/**
	 * 总分数
	 */
	private String allScore;
	
	/**
	 * 合格分数
	 */
	private String passedScore;
	
	/**
	 * 出卷人
	 */
//	@OneToOne
//	@JoinColumn(name="createdid")
//	@JsonIgnoreProperties("pic")
//	private AccountModel created;
	/**
	 * 创建时间
	 */
	@CreationTimestamp
	private Timestamp creationDate ;
	
	/**
	 * 修改时间
	 */
	@UpdateTimestamp
	private Timestamp updateDate ;
	
	@ManyToMany(mappedBy="papers")
	@JsonIgnoreProperties("created")
	private Set<TestQuestionModel> questions;
	
	@OneToMany
	private Set<ExamModel> exams;
	
}
